
package com.j2eefast.produce.pms.service;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.j2eefast.common.core.page.Query;
import com.j2eefast.common.core.utils.PageUtil;
import com.j2eefast.framework.utils.Constant;
import com.j2eefast.framework.utils.UserUtils;
import com.j2eefast.produce.pms.entity.PmsReviewEntity;
import com.j2eefast.produce.pms.mapper.PmsReviewMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>评审</p>
 *
 * @author: summer
 * @date: 2021-05-28 16:47
 * @web: http://www.letukeji.cn
 * @version: 1.0.1
 */
@Service
@Transactional(readOnly = true)
public class PmsReviewService extends ServiceImpl<PmsReviewMapper, PmsReviewEntity> {

	@Resource
	protected PmsReviewMapper pmsReviewMapper;


	/**
	 * 页面展示查询翻页
	 */
	public PageUtil findPage(Map<String, Object> params) {
		String projectName = (String) params.get("projectName");
		String total = (String) params.get("total");


		Page<PmsReviewEntity> page = pmsReviewMapper.findPage(
				new Query<PmsReviewEntity>(params).getPage(),
				StrUtil.nullToDefault(projectName,""),
				StrUtil.nullToDefault(total,""),
				(String) params.get(Constant.SQL_FILTER));
		return new PageUtil(page);
	}
	@Transactional(rollbackFor = Exception.class)
	public boolean deleteByIds(Long[] ids) {

		return pmsReviewMapper.deleteByIds(ids);

	}
	@Transactional(rollbackFor = Exception.class)
	public boolean updateCheck(Long id) {
		Long userId= UserUtils.getUserInfo().getId();

		return pmsReviewMapper.updateCheck(id ,userId);

	}



}
